package main

import (
	"fmt"
	"time"
)

/**
... 0
... 1
... 2
0 hello 0
0 hello 1
0 hello 2
...
...
 */
func main() {
	ch := make(chan string)

	//start a goroutine
	for i := 0; i < 5000; i++ {
		go printinfo(ch, i)
	}
	for {
		msg := <-ch
		fmt.Println(msg)
	}

	//	pause()
}
func printinfo(ch chan string, j int) {
	ch <- fmt.Sprintln(j, "hello")
}
func pause() {
	//cpu:	38.3 %
	//for true {
	//	;
	//}
	//cpu:	0 %
	for true {
		time.Sleep(time.Hour * 1)
	}
	//cpu:0%
	//time.Sleep(time.Minute * 60)
	//cpu:0%
	//	a := "1"
	//	fmt.Scanf("%s", &a)
}
